Skip to content

feat(taxonomy): add publish and unlocalize - #227

Open
reeshika-h wants to merge 2 commits into
developmentfrom
feat/DX-10479-taxonomy-publish
Open

reeshika-h wants to merge 2 commits into
developmentfrom
feat/DX-10479-taxonomy-publish

Conversation

@reeshika-h

Copy link
Copy Markdown
Contributor

Problem

The .NET management SDK can localize a taxonomy but has no call for the
"Publish taxonomies" API (POST /v3/taxonomies/publish) and no explicit way to
unlocalize one. The only route to removing a localized version was Delete
with a hand-built locale query parameter, and the same Delete without it
removes the whole taxonomy, so a missing argument could silently destroy data.

Ticket: https://contentstack.atlassian.net/browse/DX-10479

Fix

  • Taxonomy.Publish / PublishAsync(TaxonomyPublishModel model, ...) post a
    flat { locales, environments, items: [{ uid }] } body to
    /taxonomies/publish (no api_version or scheduled_at, no payload
    validation; a null item is sent as {"uid":null} and left for the API to
    reject). The optional Branch goes only in the branch header. Publish is
    collection-level: a uid-bound or Taxonomy("") instance throws
    InvalidOperationException. The XML docs say a 2xx means accepted, not
    completed, and point at the publish queue.
  • Taxonomy.Unlocalize / UnlocalizeAsync(string locale, ...) send
    DELETE /taxonomies/{uid}?locale=… and return the 204 without parsing it.
    The locale is required and restricted to letters, digits, - and _
    (query values are appended unencoded), so an unlocalize can never become a
    whole-taxonomy delete. The checks run login, then uid, then locale, before
    any request is sent.
  • Branch is rejected with ArgumentException if it contains a control
    character: a CR or LF there injected a second header line on the wire.
    Non-ASCII values pass the guard and are refused by .NET at send time.
  • New internal constants LocaleRequired and BranchInvalid; existing methods,
    including Localize, are unchanged.
  • Known and left for follow-up tickets (shared code, not this change): the
    stack-level BranchUid header has the same injection; the uid goes into
    the path unescaped (Taxonomy("tx#").Unlocalize("en") becomes a delete of
    /taxonomies/tx); collection keys and values are appended unencoded.
  • Tests: the taxonomy unit class passes (101 tests), including
    mutation-checked guard-order tests for Publish, and six live-stack tests
    (Test280–Test285) for publish and unlocalize. The live-stack tests have
    not been run yet: they need a stack with environments, locales and a
    main branch. Snyk did not run locally; CI's scan covers it.

reeshika-h and others added 2 commits December 4, 2026 17:44
Publish posts a flat { locales, environments, items: [{ uid }] } body to
/taxonomies/publish. It is collection-level, so it is rejected on a
taxonomy bound to a uid, and the optional branch is sent only as a header.
The API only reports that the request was accepted, so the XML docs say a
2xx means accepted and point at the publish queue for the outcome.

Unlocalize deletes the taxonomy with a required locale. The locale is
checked after login and uid, and restricted to letters, digits, '-' and
'_' because query values are appended unencoded; without it a DELETE
removes the whole taxonomy. A Branch containing a control character is
rejected, since it would inject another header line.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@reeshika-h
reeshika-h requested a review from a team as a code owner December 4, 2026 12:16
@reeshika-h reeshika-h self-assigned this Dec 4, 2026
@snyk-io

snyk-io Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant